package com.mnb.base.controller;

import com.mnb.base.entity.StRvfcchB;
import com.mnb.base.entity.StRvfcchB;
import com.mnb.base.service.StRvfcchBService;
import com.mnb.base.service.impl.StRvfcchBServiceImpl;
import com.mnb.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * (ST_RVFCCH_B)表控制层
 *
 * @author xxxxx
 */
@RestController
@RequestMapping("/st_rvfcch_b")
public class StRvfcchBController {
    @Autowired
    private StRvfcchBService stRvfcchBService;

    @RequestMapping("/list")
    public R list(StRvfcchB stRvfcchB) {
        return stRvfcchBService.getList(stRvfcchB);
    }

    @RequestMapping("/insert")
    public R insert(@RequestBody StRvfcchB stRvfcchB) {
        stRvfcchB.setModitime(new Date());
        return stRvfcchBService.insert(stRvfcchB);
    }

    @RequestMapping("/udpate")
    public R udpate(@RequestBody StRvfcchB stRvfcchB) {
        return stRvfcchBService.udpate(stRvfcchB);
    }

    @RequestMapping("/delete")
    @Transactional
    public R delete(@RequestBody List<StRvfcchB> list) {
        for (StRvfcchB stRvfcchB : list) {
            stRvfcchBService.deleteByPrimaryKey(stRvfcchB.getStcd());
        }
        return R.ok();
    }
}
